package com.yonyou.fbpm.demo;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;

import java.time.Instant;
import java.time.ZoneId;

/**
 * @author yangzyh
 * @date 2021/1/18 18:08
 */
//@ControllerAdvice
public class CustomExceptionHandler {
    private static final Logger LOG = LoggerFactory.getLogger(CustomExceptionHandler.class);

    @ExceptionHandler
    //@ResponseStatus(HttpStatus.BAD_REQUEST)
    public void handle(Exception e) throws Exception {
        LOG.error("Returning HTTP 400 Bad Request", e);
        throw e;
    }

    public static void main(String[] args) {
        Instant msgPrepareEnd = Instant.now();
        System.out.println(msgPrepareEnd.atZone(ZoneId.systemDefault()));
    }
}
